Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: toggle tabline when tab added w/o new buffer #902

Closed
wants to merge 1 commit into from

Conversation

baodrate
Copy link

Currently, when a tab is created without a new buffer being added (e.g. <C-W>s<C-W>T), tabline visibility is not toggled. Fix this edge case so that the tabline is displayed when there are either >1 buffers or the tab indicators are enabled and there are >1 tabs.

Currently, when a tab is created without a new buffer being added (e.g.
`<C-W>s<C-W>T`), tabline visibility is not toggled. Fix this edge case
so that the tabline is displayed when there are either >1 buffers or the
tab indicators are enabled and there are >1 tabs.
@akinsho
Copy link
Owner

akinsho commented May 20, 2024

Tab indicators should be the thing that triggers tabline visibility the tab indicators are about whether or not the indicator for buffer users is visible or not. I don't think I understand this problem entirely since AFAICT, the situation you describe of using this command should still cause the tab count to be > 1 and so that should be enough to trigger visibility

@baodrate
Copy link
Author

the situation you describe of using this command should still cause the tab count to be > 1 and so that should be enough to trigger visibility

Note that the condition is currently config:is_tabline() and utils.get_tab_count() or utils.get_buf_count():

local function toggle_bufferline()
if not config.options.auto_toggle_bufferline then return end
local item_count = config:is_tabline() and utils.get_tab_count() or utils.get_buf_count()

When the mode is not tabs, toggle_bufferline only considers the number of buffers. So the user opens multiple tabs but with a single buffer, toggle_bufferline will never show the tabline, and even though there might be multiple tab indicators visible, the entire tabline is still hidden.

the tab indicators are about whether or not the indicator for buffer users is visible or not

Yes. I'm checking for this condition because if there are multiple tabs but a single buffer, we only need to display the bufferline if the user enables the tab indicators. This is to avoid the confusing situation of bufferline displaying when there is a single buffer and tab indicators are hidden.

@akinsho
Copy link
Owner

akinsho commented May 21, 2024

Hmm tbh I'm not sure it's clear that it should behave this way. I think the tabline should only show if there are multiple buffers in buffer mode, doesn't necessarily seem right to me that it'll respond to tabs at all since that isn't the consideration in that mode. It will also certainly result in a change that some people will definitely not like and raise issues about probably

@baodrate
Copy link
Author

Okay. My reasoning is that if the user both enabling tab indicators and explicitly opening multiple tabs is a good indication that they'd like to see those tabs. But I respect your judgement. I have this function monkey-patched in my config so I can live with it.

@akinsho akinsho closed this Jul 18, 2024
@akinsho
Copy link
Owner

akinsho commented Jul 18, 2024

Thanks @baodrate for the contribution, I'll revisit this if a bunch of other people start clamouring for it but in the short term I'd rather avoid changes that could stir up issues or conversation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants